package com.wisezone.HomeWork.home0217;

import com.wisezone.demo0217.Person;

public class Test01 {
    public void test4()throws Exception{
        //1.获取一个系统加载器
        ClassLoader load1 = ClassLoader.getSystemClassLoader();
        System.out.println(load1);
        //2.获取系统类加载器的父类加载器，即扩展类加载器
        ClassLoader load2 = load1.getParent();
        System.out.println(load2);
        //观察Class是由哪个加载器加载的
        //自定义类是由系统的加载器加载：
        Class clazz1 = Person.class;
        ClassLoader pLoad = clazz1.getClassLoader();
        System.out.println(pLoad);
        //这个属于核心类，核心类都加载不到
        String className = "java.lang.Object";
        Class clazz2 = Class.forName(className);
        ClassLoader oLoad = clazz2.getClassLoader();
        System.out.println(oLoad);
    }
}
